// 简单的导航服务，用于在不同页面间进行跳转
const NavigationService = {
    // 切换到材料库页面
    goToMaterialLibrary: () => {
        console.log('NavigationService: 准备导航到材料库');
        console.log('导航前哈希值:', window.location.hash);

        // 设置哈希路径
        window.location.hash = 'textures';
        console.log('设置哈希后:', window.location.hash);

        // 触发页面刷新，确保组件重新渲染
        console.log('触发hashchange事件');
        window.dispatchEvent(new HashChangeEvent('hashchange'));

        // 延迟检查
        setTimeout(() => {
            console.log('延迟检查 - 当前路径:', window.location.hash);
        }, 200);
    },

    // 切换到模型库页面
    goToModelLibrary: () => {
        window.location.hash = 'models/library';
        window.dispatchEvent(new HashChangeEvent('hashchange'));
    },

    // 切换到创建模型页面
    goToCreateModel: () => {
        window.location.hash = 'models/create';
        window.dispatchEvent(new HashChangeEvent('hashchange'));
    },

    // 切换到编辑模型页面
    goToEditModel: (modelId) => {
        window.location.hash = `models/edit/${modelId}`;
        window.dispatchEvent(new HashChangeEvent('hashchange'));
    },

    // 获取当前路径
    getCurrentPath: () => {
        return window.location.hash.slice(1) || 'models/library';
    }
};

export default NavigationService; 